package api

import (
	"gitee.com/yangwencheng/vblog/apps/comment"
	"github.com/gin-gonic/gin"
)

func NewHandel(srv comment.Service) *Handler {

	return &Handler{srv: srv}
}

type Handler struct {
	srv comment.Service
}

func (h *Handler) Register(r gin.IRouter) {

	// 列表
	r.GET("/vblog/api/v1/comments", h.QueryComment)
	// 创建
	r.POST("/vblog/api/v1/comments", h.CreateComment)
	// 详情
	r.GET("/vblog/api/v1/comments/:id", h.ShowComment)
	// 更新
	r.PUT("/vblog/api/v1/comments/:id", h.UpdateComment)
	//删除
	r.DELETE("/vblog/api/v1/comments/:id", h.DeleteComment)
}
